class MyUtils{
	constrctor(){
		
	}
	
	
	//返回?后的json对象
	 getRequest() {
	    //获取url中"?"符后的字串
	    var url = location.search;
	    var theRequest = new Object();
	    if (url.indexOf("?") != -1) {
	        var str = url.substr(1);
	        var strs = str.split("&");
	        for (var i = 0; i < strs.length; i++) {
	            //theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
	            theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
	        }
	    }
	    return theRequest;
	}
	
	//时间格式为字符串
	 myformatter(date){
	    var y = date.getFullYear();
	    var m = date.getMonth()+1;
	    var d = date.getDate();
	    return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
	}
	
	//字符串解析为时间  07/24/2018
	 myparser(s){
	    if (!s) return new Date();
	    var ss = (s.split('-'));
	    var y = parseInt(ss[0],10);
	    var m = parseInt(ss[1],10);
	    var d = parseInt(ss[2],10);
	    if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
	        return new Date(y,m-1,d);
	    } else {
	        return new Date();
	    }
	}
	
	 checkLogin(){
		if( sessionStorage.getItem("user")){
		
		}else{
			alert("请先登录");
			location.href="login.html";
		}
	}
}
let utl=new MyUtils();
export default utl;